fndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QTcpSocket>
#include <QThread>
#include "../common/common.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
	    Q_OBJECT

	public:
		        MainWindow(QWidget *parent = nullptr);
			    ~MainWindow();

			    private slots:
				        void on_loginButton_clicked();
			        void on_sendButton_clicked();
				    void readSocket();
				        void disconnected();

	private:
					    Ui::MainWindow *ui;
					        QTcpSocket *socket;
						    QString username;
						        unsigned char session_key[16];
							    char salt[SM3_DIGEST_LENGTH];
							        
							        void showMessage(const QString &message);
								    void sendLoginRequest(const QString &username, const QString &password);
								        void sendChatMessage(const QString &message);
};

#endif // MAINWINDOW_H
